/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package collections;

import java.util.ArrayList;
/**
 *
 * @author Iskandar Sarkawi
 */
public class Notebook {

    private ArrayList<String> notes;

    /*
     * initialization for Notebook
     */
    public Notebook(){
        notes = new ArrayList<String>();        
    }

    /*
     * Store a new note in the notebook
     * @param note The note to be stored
     */
    public void storeNote(String note){
        notes.add(note);
    }

    /*
     * @return The number of notes currently in the notebook
     */
    public int getNumberOfNotes(){
        return notes.size();
    }

    /*
     * Show a note
     */
    public void showNote(int noteNumber){
        if(noteNumber < 0){
            System.out.println("Not a valid note number!");
        }
        else if(noteNumber < getNumberOfNotes()){
            System.out.println(notes.get(noteNumber));
        }
        else{
            System.out.println("Not a valid note number!");
        }
    }

    public boolean removeNote(int noteNumber){
        if(noteNumber < 0){
            System.out.println("Not a valid note number!");
            return false;
        }
        else if(noteNumber < getNumberOfNotes()){
            notes.remove(noteNumber);
            return true;
        }
        else{
            System.out.println("Not a valid note number!");
            return false;
        }
    }

    public void printNotes(){
        for(int i=0; i<getNumberOfNotes(); i++){
            String value = notes.get(i);
            System.out.println(value);
        }
    }

    public void alternatePrintNotes(){        
        for(String value: notes){
            System.out.println(value);
        }

        /*
         for(ElementType element : collection){
            System.out.println(element);
         }
         */
    }

}
